/*
 *  GuiButton.h
 *  SpaceTrader
 *
 *  Created by Jake on 9/21/12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 * A clickable button for the GUI. Give it an x y and optionally text to be placed on it and a "type,"
 * which is just string containing the file name (a .png is assumed).
 * 
 */
#include "GuiTools.h"
#include <iostream>
#pragma once

enum button_state_t { NONE, MOUSEOVER, CLICKED };

class GuiButton
{
private:
	int state;
	SDL_Surface *label;
	SDL_Rect bounds;
	SDL_Surface *icon;
	SDL_Rect clip[4];
	
public:
	
    /*
     * Just an x, y. A plain button.
     */
	GuiButton(int x, int y);
    
	/*
     * x, y, and optional type and text. To avoid passing one of these in, pass in "", the empty string.
     */
	GuiButton(int x, int y, std::string type, std::string text);
	GuiButton(const GuiButton &G);
	~GuiButton();
    GuiButton& operator=(const GuiButton &G);
	
	//handles key presses
	button_state_t handle_input(SDL_Event event);
	
	void setState(int nextState);
	int getState(void);

	
	//Renders button
	void show(SDL_Surface *screen);
    
};
